import java.util.Set;

public class TreeSet {


    public static void main(String[] args) {
        Set<String> s = new java.util.TreeSet<>();
        s.add("apple");
        s.add("apple");//不输出
        s.add("orange");
        s.add("peach");
        System.out.println(s.size());
        System.out.println(s);

        //contains(key):如果 key 存在,返回true,否则返回false
        System.out.println(s.contains("apple"));
        System.out.println(s.contains("watermelen"));
        System.out.println("=============================");

        //remove(key):key存在,删除成功返回true,
            //key 不存在,删除失败返回false
            //key为空,抛出空指针异常
        s.remove("apple");
        System.out.println(s);
        s.remove("123");




    }


}
